//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#include <elasysapi.h>
#include <stdlib.h>
#include <aura.h>
#include "crt0.h"

extern long g_lNeedCleanUp;
EXTERN_C PATEXIT_DATA g_pDllExitStack;

#ifdef _GNUC
#define _CRTIMP  __attribute__ ((dllimport))
#else
#define _CRTIMP  __declspec(dllimport)
#endif

EXTERN_C void mainCRTStartup(void);
void mainCRTStartup(void)
{
    int ret;
    char *argv[MAXIMUM_ARGC];

//    WStringBuf_<MAXIMUM_FULL_PATH_LENGTH> esbCmdName;
//    WStringBuf_<MAXIMUM_ARGS_LENGTH> esbCmdArgs;
    g_pDllExitStack = (PATEXIT_DATA)-1;
    _crtinit(1);
    __exeatexit(_dtorlist);

//    _EzGetStartInfo(&esbCmdName, &esbCmdArgs);

//    argc = ParseArgs(wargv, (wchar_t*)(esbCmdName.GetPayload()),
//                    (wchar_t*)(esbCmdArgs.GetPayload()));
    argv[0] = "ElCentral.exe";

    ret = main(1, argv);

    exit(ret);
}
